;solution for euler 20

(defun ctod (char)
	(if (typep char 'number)
		(return-from ctod char)
		(return-from ctod (- (char-code char) (char-code #\0)))))
	
;;originally from eu20
(defun eu20-add-digits (seq)
	(reduce #'(lambda (a b) (+ (ctod a) (ctod b))) seq))
	
(defun solve-euler16 ()
	(let ((x 1))
		(dotimes (i 1000) (setq x (* x 2)))
		(format t "Euler 16: ~a" (eu20-add-digits (write-to-string x)))))